// SKU模块接口管理
import request from "@/utils/request";
enum API {
  // 获取已有的SKU数据
  SKU_URL = "/admin/product/list/",
  // 上架SKU
  SALE_URL = "/admin/product/onSale/",
  // 下架SKU
  CANCELSALE_URL = "/admin/product/cancelSale/",
  // 获取SKU详情
  SKUDETAIL_URL = "/admin/product/getSkuInfo/",
  // 删除SKU
  DELETE_URL = "/admin/product/deleteSku/",
}

// 获取SKU接口
export const reqSkuList = (page: number, limit: number) =>
  request.get<any, any>(API.SKU_URL + `${page}/${limit}`);

// 上架请求
export const reqSaleSku = (skuId: number) =>
  request.get<any, any>(API.SALE_URL + skuId);

// 下架请求
export const reqCancelSale = (skuId: number) =>
  request.get<any, any>(API.CANCELSALE_URL + skuId);

// 获取SKU详情
export const reqSkuInfo = (skuId: number) =>
  request.get<any, any>(API.SKUDETAIL_URL + skuId);

// 删除SKU
export const reqDeleteSku = (skuId: number) =>
  request.delete<any, any>(API.DELETE_URL + skuId);
